
import 'package:zcw_eyepetizer/model/paging_model.dart';

import 'common_item.dart';

class IssueEntity extends PagingModel<Item> {
  late int nextPublishTime;
  String? newestIssueType;
  List<Issue>? issueList;

  IssueEntity({required this.nextPublishTime, this.newestIssueType});

  IssueEntity.fromJson(Map<String, dynamic> json) {
    nextPublishTime = json['nextPublishTime'];
    newestIssueType = json['newestIssueType']??"";
    nextPageUrl = json['nextPageUrl']??"";
    if (json['issueList'] != null) {
      issueList = [];
      itemList = [];
      try {
        for (var v in (json['issueList'] as List)) {
                issueList!.add(Issue.fromJson(v));
              }
      } catch (e) {
        print(e);
      }
      itemList = issueList![0].itemList;
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['nextPublishTime'] = nextPublishTime;
    data['newestIssueType'] = newestIssueType ?? "";
    data['nextPageUrl'] = nextPageUrl;
    if (issueList != null) {
      data['issueList'] = issueList?.map((v) => v.toJson()).toList();
    }
    return data;
  }
}